<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="app">
        
    </div>

    <hr>

    <!-- 定义模板 -->
    <template id="hello">
        <!-- 必须只有一个根元素 -->
        <div>
            <p>{{ msg }}</p>
            <h2>{{ name }}</h2>

            <button @click="name='alice'">修改数据</button>
        </div>
    </template>

    <script>
        new Vue({
            el: '#app', // 挂载点
            data: {
                msg: 'welcome',
                name: 'tom'
            },
            template: '#hello',
            created(){
                console.log('created.......')
            },
            mounted(){
                console.log('mounted.......')
            },
            updated(){
                console.log('updated.......')
            }
        })
    </script>
</body>
</html>